<template>
    <span class="span-left">
      <el-button
        v-if="!statusUtil.canDelete(row)"
        :class="!statusUtil.canCancel(row)?'disabled-button':''"
        :disabled="!statusUtil.canCancel(row)"
        icon="el-icon-delete-solid"
        size="mini"
        type="text"
        @click="doCancel(row)"
      >作废
      </el-button>
      <el-button
        v-if="statusUtil.canDelete(row)"
        :class="statusUtil.canDelete(row) ?'':'disabled-button'"
        :disabled="!statusUtil.canDelete(row)"
        icon="el-icon-delete"
        size="mini"
        type="text"
        @click="handleDelete(row)"
      >删除
      </el-button>
    </span>
</template>

<script>

import { cancel } from '@/api/activiti/task'

export default {
  name: 'InvalidButton',
  props: {
    row: {
      required: true,
      type: Object
    }
  },
  data() {
    return {

      }
    },
    methods: {
      doApproval() {
        this.$emit('approval');
      },
      // 作废
      doCancel(row) {
        cancel(row.taskId).then(res => {
          if (res && res.code === 200) {
            this.msgSuccess("作废成功")
            this.$emit('refreshDataList')
          }
        });
      },
      handleDelete(row) {
        this.$emit('handleDelete', row);
      }
    }
  }
</script>

<style scoped>

  .span-left {
    margin-left: 10px;
  }
</style>
